package com.peanut.youfupay.service.must;


import com.alibaba.fastjson.JSON;
import com.peanut.youfupay.entity.request.PaymentQuery;
import com.peanut.youfupay.entity.response.PaymentQueryResult;
import com.peanut.youfupay.entity.response.ResponseMessage;
import com.peanut.youfupay.enums.FunCodeEnum;
import com.peanut.youfupay.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 商户付款查询
 *
 * @author peanut
 */
@Slf4j
@Service("paymentQueryService")
public class PaymentQueryService extends BaseService {

    /**
     * @param funCodeEnum
     * @param paymentQuery
     * @return
     * @throws Exception
     */
    public PaymentQueryResult doBusiness(FunCodeEnum funCodeEnum, PaymentQuery paymentQuery) throws Exception {
        log.info("付款查询开始:{}，{}", funCodeEnum, paymentQuery);
        ResponseMessage responseMessage = applyYouFuByHttpPost(funCodeEnum, paymentQuery);
        PaymentQueryResult paymentQueryResult = JSON.parseObject(responseMessage.getResData(), PaymentQueryResult.class);
        log.info("付款查询结束:{}", paymentQueryResult);
        return paymentQueryResult;
    }
}

